﻿/*!
 * 编辑控件.
 * ecp.qzz.ui.input.edit.js
 * 创建：QZZ
 * 日期：2014-03-01
 */
define(["qzz.window","qzz.plistview"], function() {
	
	var qzz = window.qzz;
	qzz.space("ui.input");
	/**
	 * 编辑控件.
	 */
	qzz.ui.input.edit = qzz.Class(qzz.ui.window, {
		/**
		 * 创建.
		 */
		_create:function(){		    
		    this.base();
		    this.className = "Edit";
		    this.logInfo("text.create");
		    //对齐方式
		    this.align = "left";
		    this.valign = "middle";
		    this.selectState = false;
		    this._isChanged = false;
		    this._twoRefresh = true;
		    this._value = "";
		    this._text = "";
		    this.format = "";
		    //宽高
		    if(this.getOption().width == null) {
		        this.getOption().width = this.getOption().width || 100;
		    }
		    if(this.getOption().width < 30) {
		    	this.getOption().width = this.getOption().width || 30;
		    }
		    if(this.getOption().height == null || this.getOption().height <= 10) {
			    if(this.getBrowser("msie")) {
			    	this.getOption().height = 34;
			    } else {
			        this.getOption().height = 35;
			    }
		    } else {
		    	this.getOption().height = this.getOption().height;
		    }
		    if(this.isEmpty(this.getOption().fontSize)) {
		    	this.getOption().fontSize = 14;
		    }
		    var iw = this.getOption().width;
		    if(iw != null && iw !== "" && !/[\d]+%$/.test(this.getOption().width)) {
		    	this.getOption().width = parseInt(iw, 10);
		    }
		    this.getOption().idkey = this.getOption().idkey || "id";
		    this.getOption().capkey = this.getOption().capkey || "text";
		    this.getOption().hint = this.getBooleanValue(this.getOption().hint, false);
		    if(this.getOption().hintData == null) {
		        this.getOption().hintData = [];
		    }
		    this._readOnly = this.getOption().readOnly === true;
		    this.size = this._getNumberValue(this.getOption().size, 4000);
		    this._popState = false;
	
	    },
	    /**
	     * 渲染.
		 * @name render
		 * @ignore
	     */
	    _render:function(){
	    	//兼容用Input配置的情况.
	    	var placeholder = null;
	    	if(this.control != null) {
	    	    placeholder = this.control.attr("placeholder");
	    	}
	    	if(this.control && this.control[0].tagName === "INPUT") {
	    		var conDiv = $(this.createElement("div"));
	    		conDiv.attr("dataField", this.control.attr("dataField"));
	    		conDiv.attr("data-option", this.control.attr("data-option"));
	    		conDiv.attr("id", this.control.attr("id"));
	    		conDiv.attr("name", this.control.attr("name"));
	    		conDiv.attr("width", this.control.attr("width"));
	    		this.control.replaceWith(conDiv);
	    		this.control = conDiv;
	    		this.control.data("_ecpUI", this);
	    		this.thisWindow = conDiv[0];
	    	}
	    	placeholder =  placeholder || this.getOption().placeholder;
	    	this.base();
	    	//this.thisWindow.style.border = "1px solid #A4BED4";
		    this.logInfo("text.render");
		    //输入input
	    	this.inputBox = this.createElement("textarea");
	    	if(placeholder != null) {
	    		this.inputBox.setAttribute("placeholder", placeholder);
	    	}
	    	this.inputBox.ctrl = this;
	    	if(this.isNotEmpty(this.getOption().fontSize)) {
	    		this.inputBox.style.fontSize = this.getOption().fontSize + "px";
	    	}
	    	this.pasteKeyPress = false;
	    	//按键控制
	    	this.inputBox.onkeydown = this.doInput;
	    	
	    	var _this = this;
	    	this.inputBox.onclick = function(ev) {
	    		var ev = ev || event;
	    		if(typeof _this.onEditClick == "function") {
	    		    _this.onEditClick(ev);
	    		}
	    		//鼠标选择的时候提示
	    		if(_this.getOption().hint === true && this.value !== "") {
    	    		//添加过滤
    	    		_this._doShowHintView();
    	    	}
	    	}
	    	this.inputBox.onchange = function(ev) {
	    		var ev = ev || event;
	    		_this.logInfo("inputBox.onChange$$$$$$$$$$$$");
	    		_this._isChanged = true;
	    		if(typeof _this.onEditClick == "function") {
	    		    _this.onEditClick(ev);
	    		}
	    	}
	    	if(this.dataField != null) {
	    		var dm = this.getDataSource().getDataModel();
	    		if(dm != null) {
	    		    this._value = dm.get(this.dataField).value();
	    		}
	    	}
	    	//样式	    		
	    	if(this.getOption().inputCss != null && this.getOption().inputCss !== "") {
	    		this.setStyle(this.inputBox, this.getOption().inputCss);
	    		this.inputBox.style.border = "0px solid #FFFFFF";
	    		this.inputBox.style.resize = "none";
	    		this.inputBox.style.textAlign = this.align;
	    	} else {
	    		this.setStyle(this.inputBox, "editTextInputer");
	    	}
	    	/*
	    	 * 指定样式.
	    	 */
	    	if(this.getOption().className != null && this.getOption().className !== "") {
	    		this.addStyle(this.thisWindow, this.getOption().className);
	    	}
	    	//智能提示
	    	if(this.getOption().hint === true) {
	    		this.hintView = new qzz.ui.drop.poplistview(null, {height:300,width:200,idkey:this.getOption().idkey, capkey:this.getOption().capkey});
	    		this.hintView.setParent(this.getModelBody());
	    		var that = this;
	    		this.hintView.onSelect = function(index, item) {
	    		    that.setValue(item);
	    		}
	    		if(this.isArray(this.getOption().hintData)) {
	    			this.hintView.setItemList(this.getOption().hintData);
	    		}
	    	}
	    	//显示直线
	    	if(this.getOption().underLine === true) {
	    		this.addStyle(this.thisWindow, "underLine");
	    	}
	    	
	    	this.refresh();
	    },
	    /**
	     * 设置提示用的数据列表.
	     * @param datas 数据包
	     */
	    setHintData:function(datas) {
	    	if(this.isArray(datas)) {
	    	    this.getOption().hintData = datas;
	    	    if(this.getOption().hint === true) {
	    	        this.hintView.setItemList(this.getOption().hintData);
	    	    }
	    	}
	    },
	    /**
	     * 输入大小.
	     * @param size 值
	     */
	    setSize:function(size){
	    	if(this.isEmpty(size)) return;
        	this.size = size;
        	$(this.inputBox).attr("maxlengh",this.size);
        },
        /**
         * 是否是控制件.
         * @param key 键值
         */
	    isCtrlKey:function(key) {
            /*
            //8：退格键、46：delete、37-40： 方向键
            //13 回车键
            //110、190：小键盘区和主键盘区的小数点
            //189、109：小键盘区和主键盘区的负号
            */    	
	        return (key >= this.keyBoard.Left && key <= this.keyBoard.DOWN 
	        		  || key == this.keyBoard.ENTER);
        },
        /**
         * 获取鼠标位置.
         * @param input 元素
         */
	    getPosition:function(input){
			var CaretPos = 0;
			if (document.selection) { // IE Support
				input.focus();
				var rng = document.body.createTextRange();
				rng.moveToElementText(input);
				var srng = document.selection.createRange();
				srng.setEndPoint("StartToStart", rng);
				CaretPos = srng.text.length
			}else if(input.selectionStart || input.selectionStart == '0'){// Firefox support
			    CaretPos = input.selectionStart;
			}
			return (CaretPos); 
		},
		/**
		 * 设置鼠标位置.
		 * @param ctrl 元素
		 * @param sIndex 开始位置
		 * @param eIndex 结束位置
		 */
		setPosition:function(ctrl, sIndex, eIndex) {
			if(eIndex == null) {
				eIndex = sIndex;
			}
			if(document.selection){
				//ie
				try {
					var range = ctrl.createTextRange();
					range.moveEnd('character', -ctrl.value.length); 
					range.moveEnd('character', eIndex);
					range.moveStart('character', sIndex);
					range.select();
					range = null;
				} catch(e) {
					this.logInfo("ERROR: "+ this.getI18n("qzz.setPositionErr", "设置选择位置报错") + e.message + e.stack)
				}
			}else{
				//其它
				ctrl.setSelectionRange(sIndex, eIndex);
				ctrl.focus();
			}
		},
		/**
		 * 获取选择字符串.
		 * @param input 元素
		 * @return 返回
		 */
		getSelText:function(input) {
			var seltext = "";
			if (document.selection) { // IE Support 
				var o = input;
	            var r = document.selection.createRange();
	            //if(o.createTextRange().inRange(r))
	            if(o.createTextRange().text.indexOf(r.text) >= 0) {
	               seltext = r.text;
	            }	               
	            o = null;
	            r = null;
			}else if(input.selectionStart || input.selectionStart == '0'){// Firefox support 
			    var s = input.selectionStart;
			    var e = input.selectionEnd;
			    seltext = input.value.substr(s, e - s);
			    s = null;
			    e = null;
			} 
			return seltext; 
		},
		/**
		 * 执行焦点事件.
		 * @param ev 事件对象
		 */
	    doFocus:function(ev){	
	    	if(!this.selectState) {
		    	this.selectState = true; 
	    		this.base(ev);
	    		var inpBox = this.inputBox;
	    		setTimeout(function(){
	    			if(inpBox != null && inpBox.offsetWidth > 0) {
	    			    inpBox.focus();
	    			    inpBox.select();
	    			}
	    			inpBox = null;
	    		}, 50);
	    	}
	    },
	    /**
	     * 提交值.
	     */
	    postValue:function() {
	    	var value = this.inputBox.value;
	    	if(this.notnull === true && value === "") {
	    		return;
	    	}
	    	if(typeof value == "string") {
	    		value = this._tagToText(value);
			}
	    	if(this.getOption().length != null && this.getOption().length > 0) {
	    		var len = this.strLen(value);
	    		if(len > this.getOption().length) {
	    			value = this.subStr(value, this.getOption().length);
	    		}
	    	}
	    	this.setValue(value);
	    },
	    /**
	     * 执行失去焦点事件.
	     * @param ev 事件对象.
	     */
	    doBlur:function(ev){	    	
	    	if(this.selectState) {
	    		this.postValue();
		    	this.selectState = false;
	    		this.base(ev);
	    	}
	    },
	    /**
	     * 执行输入控制.
	     * @param ev 事件对象.
	     */
	    doInput:function(ev) {
	    	 var ent = ev || window.event;
	         var key = ent.keyCode || ent.charCode || ent.which;
	         if(ent.ctrlKey && key == this.ctrl.keyBoard.V) {
	        	 //处理粘贴事件
		         if(this.ctrl.pasteKeyPress) {
		        	 if(ent.preventDefault) {     
		    			// Firefox       
		    		    ent.preventDefault();       
		    		    ent.stopPropagation();     
		    		 } else {
		    			// IE       
		    		    ent.cancelBubble=true;       
		    		    ent.returnValue = false;
		    		 }
		        	 return false;
		         }
	         }	         
	         if(key == this.ctrl.keyBoard.ENTER) {
	        	 //处理回车事件
	        	 if(ent.preventDefault) {     
	    			// Firefox       
	    		    ent.preventDefault();       
	    		    ent.stopPropagation();     
	    		 } else {
	    			// IE       
	    		    ent.cancelBubble=true;       
	    		    ent.returnValue = false;
	    		 }
	    		 return false
	         }
	         this.ctrl._isChanged = true;
	         var _owner = this.ctrl;
	         ent.returnValue = true;
	         if(ent.ctrlKey && key != _owner.keyBoard.CTRL) {//_ctrlKeyDown) {
	            	//控制键, 
	    	        if(key != _owner.keyBoard.C 
	    	        	&& key != _owner.keyBoard.V 
	    	        		&& key != _owner.keyBoard.X ) {
	                    ent.returnValue = false;
	                }
	    	        //粘贴
	    	        if(key == _owner.keyBoard.V) {
	    	        	//ent.returnValue = false;
	    	        	_owner.paste = true;
	    	        }
	         } else if(ent.shiftKey && key != _owner.keyBoard.SHIFT) {//if(_shiftKeyDown) {
	            	//上档键控制
	                if(key != _owner.keyBoard.END 
	                		&& key != _owner.keyBoard.HOME 
	                		    && key != _owner.keyBoard.C 
	                		        && key != _owner.keyBoard.V 
	                		            && _owner.isCtrlKey(key)) {
	                    ent.returnValue = false;
	                }
	         } else if(_owner.size != null){
	        	 var vlen = _owner.strLen(this.value);
	        	 if(vlen >= _owner.size 
	        			 && !(key >= _owner.keyBoard.END && key <= _owner.keyBoard.HOME) 
	        			     && key != _owner.keyBoard.CTRL 
	        			         && key != 20
	        			             && key != _owner.keyBoard.BACKSPACE 
	        			                 && key != _owner.keyBoard.DEL 
	        			                     && !_owner.isCtrlKey(key)) {
	        		 ent.returnValue = false;
	        	 }
	         }
	         return ent.returnValue;
	    },
	    /**
	     * 键盘按下.
	     * @param ev 事件对象
	     * @param key 键值
	     */
	    doKeyDown:function(ev, key) {
	    	if(ev.ctrlKey && key == this.keyBoard.V){
    			this.pasteKeyPress = true;
    			return true;
    		}
	    },
	    /**
	     * 键盘弹起.
	     * @param ev 事件对象
	     * @param key 键值
	     */
	    doKeyUp:function(ev, key) {
	    	if(key != this.keyBoard.ENTER
	   			 && key != this.keyBoard.UP
				    && key != this.keyBoard.DOWN
				    && key != this.keyBoard.LEFT
				    && key != this.keyBoard.RIGHT
				    && !this.isCtrlKey(key)
				    && this.inputBox.value != null 
	    			//&& this.inputBox.value !== ""
	    				&& this._tmpInputValue !== this.inputBox.value
	    		) {
	    		if(this.getOption().hint === true) {
	    		    this._doShowHintView();
	    		}
	    		this.trigger("onChange", [this.inputBox.value]);
	    	}
	    	if(this.getOption().hint === true && key == this.keyBoard.F2) {
	    		this._doShowHintView();
	    	}
	    	this._tmpInputValue = this.inputBox.value;
    		this.pasteKeyPress = false;
    		
	    },
	    _doShowHintView:function(){
	    	//添加过滤
	    	this.hintView.setWidth(this.getWidth());
	    	this.hintView.clearFilter();
	    	this.hintView.addFilter(this.inputBox.value);
	    	if(this.hintView.length() > 1) {		    		
		    	this.getAXY();
		    	this.hintView.execute(this.getATop() + this.getHeight() - 4, this.getALeft(), this.getHeight());
	    	} else if(this.hintView.length() == 1) {
	    		var ci = this.hintView.getItem(0);
	    		if(ci.text !== this.inputBox.value) {
	    			this.getAXY();
			    	this.hintView.execute(this.getATop() + this.getHeight() - 4, this.getALeft(), this.getHeight());
	    		} else {
	    			this.hintView.hide();
	    		}
	    	}	    	
	    },
	    /**
	     * 设置值.
	     * @param {string|number|object} value 值
	     */
	    value:function(value) {
        	if(value == null) {
        		return this.getValue();
        	} else {
	    		this.setValue(value);
        	}
	    },
	    /**
	     * 设置/读取文本内容.
	     * @name text
	     * @param {string} txt 字符串
	     * @return 返回文本内容
	     */
	    text:function(txt) {
	    	if(txt == null) {
	    		return this.getText();
	    	} else {
	    		this.setText(txt);
	    	}
	    },
	    /**
	     * 通过val获取text值.
	     * @param {string|number} val 值
	     * @return {string} text 显示值
	     * @ignore
	     */
	    _getTextByValue:function(val) {	    	
	    	return val;
	    },
	    /**
	     * 设置值.
	     * @param {string|number|object} value 值
	     */
	    setValue:function(value){
	    	if(typeof value == "object") {
	    		//如果是json，则拆分处理
	    		if(typeof value[this.getOption().idkey] == "boolean" && value[this.getOption().idkey] !== this._value 
	    			|| typeof value[this.getOption().idkey] != "boolean" && value[this.getOption().idkey] != this._value 
	    		      || this.inputBox.value != this._text 
	    				|| value[this.getOption().idkey] === 0 && this._value === "") {
	    			this._value = value[this.getOption().idkey];
	    			if(value[this.getOption().capkey] != null) {
	    				this.inputBox.value = value[this.getOption().capkey];
	    				this._text = value[this.getOption().capkey];
	    			} else {
	    				this.inputBox.value = this._value;
	    		    	this._text = this._value;
	    			}
	    			if(this.dataField != null) {
	    				var valValue = this._value;
	    				if(this.isArray(valValue)) {
	    					valValue = valValue.join(",");
	    				}
	    				this.getDataSource().getDataModel().get(this.dataField).value(valValue);
	    			}
	    			this._isChanged = true;
	    			this.refresh();
			    	if(typeof this.onChanged == "function" && this._update) {
			    		//事件执行.
			    		this.onChanged(this._value, this._text);
			    	}
	    		} else if(this._value == value[this.getOption().idkey] && this._text != value[this.getOption().capkey]) {
	    			this._text = value[this.getOption().capkey];
	    		}
	    	} else if(this._value != value 
	    			|| this._value === 0 && value === ""
	    				|| this._value === "" && value === 0
	    				    || this._text != this.inputBox.value) {
	    		if(value == null) {
	    			value = "";
	    		}
	    		//不一样时更新
	    		if(this.multiSelect === true && value.indexOf(",") >= 0) {
	    			this._value = value.split(",");
	    		} else {
		    	    this._value = value;
	    		}
                this._text = this._getTextByValue(this._value);
		    	this.inputBox.value = this._text;
		    	if(this.dataField != null) {
		    		var valValue = this._value;
    				if(this.isArray(valValue)) {
    					valValue = valValue.join(",");
    				}
    				this.getDataSource().getDataModel().get(this.dataField).value(valValue);
    			}
		    	this._isChanged = true;
		    	this.refresh();
		    	if(typeof this.onChanged === "function" && this._update) {
		    		//事件执行.
		    		this.onChanged(this._value, this._text);
		    	}
		    }
	    	var _this = this;
	    	setTimeout(function() {
	    		if(_this._twoRefresh) {
		    		_this.doContainerShow();
		    		
	    		}
	    		_this = null;
	    	}, 1000);
	    },
	    /**
	     * 显示事件.
	     */
	    doContainerShow:function() {
	    	//ie11 显示不出来
	    	if(this.inputBox != null) {
    			var w = this.inputBox.offsetWidth;
    			this.inputBox.value = this.inputBox.value;
    			var $d = $(this.inputBox).parent("div.winStyle");
				if($d.length !== 0){
					$d.addClass("winStyle");
				}
    		}
	    	//显示完成后，就不需要再处理了
	    	if(this.showHandle != null) {
	    	    clearInterval(this.showHandle);
	    	    this.showHandle = null;
	    	}
	    },
	    /**
	     * 获取输入值.
	     * @return 返回值
	     */
	    getValue:function(){
	    	var ms = this.size;
	    	if(ms == null) {
	    		ms = -1;
	    	}
	    	if(ms > 0 && typeof this._value == "string" && this._value.length > this.size) {
	    		return this._value.substr(0, ms);
	    	} else {
	    	    return this._value;
	    	}
	    },
	    /**
	     * 设置text值.
	     * @param text 字符串
	     */
	    setText:function(text) {
	    	this._text = text;
	    	if(this._value === "" && this._value !== text) {
	    		this._value = text;
	    		this._isChanged = true;
	    	}
	    	this.refresh();
	    },
	    /**
	     * 取text值
	     * @return text
	     */
	    getText:function() {
	    	return this._text;
	    },
	    /**
	     * 结束刷新.
	     */
	    endUpdate:function(){
	    	this._update = true;
	    	this._doResize();
	    	this.refresh();
	    },
	    /**
	     * 设置对齐.
	     */
	    setAlign:function(align){
	    	this.align = align;
	    	this.refresh();
	    },
	    /**
	     * 获取对齐.
	     */
	    getAlign:function(){
	    	return this.align;
	    },
	    /**
	     * 设置纵向对齐.
	     */
	    setVAlign:function(align){
	    	this.valign = valign;
	    	this.refresh();
	    },
	    /**
	     * 获取纵向对齐.
	     */
	    getVAlign:function(){
	    	return this.valign;
	    },
	    /**
	     * 设置选择状态.
	     */
	    setSelectState:function(value){
	    	this.selectState = value;
	    	this.refresh();
	    },
	    /**
	     * 设置边框.
	     */
	    setBorder:function(value) {
	    	var value = value || 0;
	    	this.thisWindow.style.border = value + "px";
	    },
	    /**
	     * 设置宽度.
	     */
	    setWidth:function(value) {
	    	if(this.getWidth() != value) {
	    	    this.base(value);
	    	    this.refresh();
	    	}
	    },
	    /**
	     * 刷新.
	     */
	    refreash:function() {
	    	this.refresh();
	    },
	    /**
	     * 刷新.
	     */
	    refresh:function(){
	    	if(!this._update) return;
	    	//this.logInfo("text.refresh");
	    	if(this.thisWindow.style.align != this.align) {
	    	    this.thisWindow.style.align = this.align;
	    	}
	    	if(this.thisWindow.style.verticalAlign != this.valign) {
	    	    this.thisWindow.style.verticalAlign = this.valign;
	    	}
	    	this._setHtml(this.thisWindow, "", false);
	    	//输入框添加到面板上.
	    	var txtValue = this._text;
	    	if(this.isArray(txtValue)) {
	    		txtValue = txtValue.join(",");
	    	}
	    	this.inputBox.value = txtValue;
			if(typeof this.inputBox.value === "string") {
				this.inputBox.value = this._textToTag(this.inputBox.value);
				if(this.getOption().showHint === true) {
					this.inputBox.setAttribute("title", this.inputBox.value);
				}
			}
			if(/\d+%$/.test(this.thisWindow.style.width)) {
				this.inputBox.style.width = "100%";
			} else {
	    	    this.inputBox.style.width = this.getWidth() + "px";
			}
	    	this.inputBox.style.height = (this.getHeight() - 1) + "px";
	    	$(this.inputBox).attr("disabled", !this._enabled);
	    	if(this.getOption().disInput === true || this.getOption().readOnly === true) {
	    		$(this.inputBox).attr("readOnly", true);
	    		if(this.getOption().readOnly === true) {
	    		    this.addStyle(this.thisWindow, "readOnly");	
	    		    this.addStyle(this.inputBox, "readOnly");
	    		} else {
	    			this.delStyle(this.thisWindow, "readOnly");	
	    		    this.delStyle(this.inputBox, "readOnly");
	    		}   		
	    	}
	    	

	    	this.inputBox.style.paddingTop = ((this.getHeight() - this.getNumberValue(this.getOption().fontSize, this.getOption().defFontSize))/2 - 2) + "px";    	

	    	this.thisWindow.appendChild(this.inputBox);	  
	    	//禁用样式调整.
	    	if(!this._enabled) {
	    		this.addStyle(this.thisWindow, "disabled");
	    		this.addStyle(this.inputBox, "disabled");
	    	} else {
	    		this.delStyle(this.thisWindow, "disabled");
	    		this.delStyle(this.inputBox, "disabled");
	    	}   	
	    },
	    /**
	     * 获取初始化信息.
	     * @name getInitData
	     * @return 返回data数组
	     */
	    getInitData:function() {
	    	if(this.option.data != null && this.isArray(this.option.data)) {
	    		return this.option.data;
	    	}
	    	return [];
	    },
	    /**
	     * 初始化数据.
	     * @param {Array} data 数据数组
	     * @ignore
	     */
	    initValue:function(value) {
	    	this.setValue(value);
	    },
	    /**
	     * 不可用设置.
	     * @name disable
	     */
		disable:function(flag){
			if(flag == null) {
				flag = true;
			}
			this._enabled = !flag;	
			this.getOption().disabled = flag;
			this.refresh();
		},
		/**
		 * 可用设置.
		 * @name enable
		 */
		enable:function(flag){
			if(flag == null) {
				flag = true;
			}
			this._enabled = flag;
			this.getOption().disabled = !flag;
			this.refresh();
		},
		/**
		 * 合并变更集.
		 */
		mergeChangeLog:function() {
			this._isChanged = false;
		},
		/**
		 * 判断是否变更.
		 */
		isChanged:function() {
			return this._isChanged;
		},
		/**
		 * 只读设置.
		 * @name readonly
		 */
		readonly:function(val) {
			if(val == null) {
				val = true;
			}
			this._readOnly = val;
			this.refresh();
        },
        getReadOnly:function() {
        	return this._readOnly;
        },
        setReadOnly:function(val) {
        	this.readonly(val);
        },
        setDisInput:function(val) {
        	if(val == null) {
				val = true;
			}
			this.getOption().disInput = val;
			this.refresh();
        },
        setIdkey:function(key) {
        	this.getOption().idkey = key;
        },
        getInputValue:function() {
        	return this.inputBox.value;
        },
        getPopState:function() {
			if(this.getOption().hint === true) {
				if(this.hintView.isShow() === true && this.hintView.hasSelect === true) {
					this._popState = true;
				} else {
					this._popState = false;
				}
			}
        	return this._popState;
        },
        setPopState:function(value) {
        	this._popState = value;
        }
	});
	/**
	 * 编辑控件.
	 */
	_bindRenderFunc("qzzedit", qzz.ui.input.edit);
	return qzz.ui.input.edit;
});
	